package com.kfm.pm;

import java.text.ParseException;

// 创建一个异常类  而是创建一个继承了先有异常类的子类
public class MyException extends Exception {
    public MyException(String message) {
        super(message);
    }
}

class Test {
    public static void main(String[] args) {
        try {
            test();
        } catch (MyException e) {
            System.out.println("这里是main方法");
            System.out.println(e.getMessage());
            e.printStackTrace();
        }

    }

    public static void test() throws MyException {
        MyException e = new MyException("我是一个异常");
        System.out.println(e.getMessage());
        throw e;
    }
}
